<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<%@ taglib prefix="sec"
           uri="http://www.springframework.org/security/tags" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<div class="login-form" align="right">
<sec:authorize access="isAuthenticated()">
    <a href="<c:url value="/j_spring_security_logout"/>" align="right">
        <input type="button"
               class="button-small"
               value="<spring:message code="label.logout"/>"/>
    </a>

    <h3 align=right>Welcome, <sec:authentication property="principal.username"/></h3>
</sec:authorize>
</div>

<sec:authorize access="isAnonymous()">
    <form class="login-form" action="j_spring_security_check" method="post">
        <table align="right">
            <tr>
                <td align="center"><spring:message code="label.login"/></td>
                <td><input type="text" name="j_username"/></td>
            </tr>
            <tr>
                <td align="center"><spring:message code="label.password"/></td>
                <td><input type="password" name="j_password"/></td>
            </tr>
            <tr>
                <td align="right"><spring:message code="label.remember"/></td>
                <td>
                    <input type="checkbox" name="_spring_security_remember_me"/>
                    <input class="button-small" type="submit" value="<spring:message code="label.login"/>" align="right">
                </td>
            </tr>
        </table>
    </form>
</sec:authorize>